layui.use(['form', 'table', 'layer', 'upload'], function () {
    var $ = layui.jquery,
        form = layui.form,
        table = layui.table,
        layer = layui.layer,
        upload = layui.upload;;

    loadData(table);


});


function loadData(table, where) {
    table.render({
        elem: '#sort-info-list',
        url: dl_coder_url.blog_user_page[0],
        toolbar: '#sort-list-toolbar',
        method: dl_coder_url.blog_user_page[1],
        where: where,
        contentType: 'application/json',
        dataType: 'json',
        request: {
            pageName: 'pageNo', //页码的参数名称，默认：page
            limitName: 'pageSize', //每页数据量的参数名，默认：limit
        },
        headers: headerMap,
        defaultToolbar: ['filter', 'exports', 'print', {
            title: '提示',
            layEvent: 'LAYTABLE_TIPS',
            icon: 'layui-icon-tips'
        }],
        parseData: function (res) { //res 即为原始返回的数据
            return {
                "code": res.code, //解析接口状态
                "msg": res.msg, //解析提示文本
                "total": res.data.total, //解析数据长度
                "data": res.data.records, //解析数据列表
                "count": res.data.pages, //解析数据长度
            }
        },
        response: {
            statusName: 'code', //规定数据状态的字段名称，默认：code
            statusCode: 200,//规定成功的状态码，默认：0
            msgName: 'msg', //规定状态信息的字段名称，默认：msg
            countName: 'total', //规定数据总数的字段名称，默认：count
            dataName: 'data', //规定数据列表的字段名称，默认：data
        },
        cols: [[
            {type: "checkbox"},
            {field: 'id',align: 'center', width: 70, title: 'ID', sort: true},
            {field: 'userName',align: 'center', width: 500, title: '用户名称'},
            {field: 'userEmail',align: 'center', width: 500, title: '用户邮箱'},
            {field: 'createTime',align: 'center', width: 300, title: '添加时间'},
            {field: 'updateTime',align: 'center', width: 300, title: '修改时间'}
        ]],
        limits: [10, 15, 20, 25, 50, 100],
        limit: 15,
        page: true,
        skin: 'line',
        even: true,
        size: 'sm',
        lineStyle: 'height: 95px;',
        height: 'full-105',
        done: function () {
            setAuthority();
        }
    });
}
